home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / termsorc.lha / Extras / Source / gtlayout-source.lha / LT_GetCode.c < prev    next >
C/C++ Source or Header  |  1995-09-24  |  818b  |  36 lines

  1. /*  GadTools layout toolkit
  2. **
  3. **  Copyright © 1993-1995 by Olaf `Olsen' Barthel
  4. **  Freely distributable.
  5. */
  6.  
  7. #include "gtlayout_global.h"
  8.  
  9. WORD LIBENT
  10. LT_GetCode(REG(d0) ULONG MsgQualifier,REG(d1) ULONG MsgClass,REG(d2) UWORD MsgCode,REG(a0) struct Gadget *MsgGadget)
  11. {
  12.     if(MsgClass == IDCMP_RAWKEY && !(MsgCode & IECODE_UP_PREFIX) && KeymapBase)
  13.     {
  14.         UBYTE            Buffer[10];
  15.         struct InputEvent    Event;
  16.         LONG            Len;
  17.  
  18.         Event . ie_NextEvent        = NULL;
  19.         Event . ie_Code         = MsgCode & ~IECODE_UP_PREFIX;
  20.         Event . ie_Qualifier        = MsgQualifier;
  21.         Event . ie_Class        = IECLASS_RAWKEY;
  22.         Event . ie_SubClass        = 0;
  23.         Event . ie_position . ie_addr    = (APTR)MsgGadget;
  24.  
  25.         Buffer[0] = 0;
  26.  
  27.         if((Len = MapRawKey(&Event,Buffer,9,NULL)) > 0)
  28.         {
  29.             if(Buffer[0] != 0x9B || Len == 1)
  30.                 return((WORD)Buffer[0]);
  31.         }
  32.     }
  33.  
  34.     return(-1);
  35. }
  36.